/* eslint-disable */
export function _debounce(fn, delay) {
  var delay = delay || 200;
  let timer;
  return function() {
    const th = this;
    const args = arguments;
    if (timer) {
      clearTimeout(timer);
    }
    timer = setTimeout(() => {
      timer = null;
      fn.apply(th, args);
    }, delay);
  };
}

export function _totall(func, delay) { // 节流
  let timer = null;
  return function() {
    const context = this;
    const args = arguments;
    if (!timer) {
      timer = setTimeout(() => {
        func.apply(context, args);
        timer = null;
      }, delay);
    }
  };
}
